package com.xzq.serializer;

/**
 * @Author xzq
 * @Description //TODO
 * @Date 2021/11/22 13:20
 * @Version 1.0.0
 **/
public  class SerializerUtil {
    private static Serializer JSON = new JSONSerializer();
    private static Serializer JDK = new JDKSerializer();
    private static   Serializer PROTOBUF = new ProtoBufSerilizer();

    public static Serializer JSON() {
        return JSON;
    }
    public static Serializer JDK() {
        return JDK;
    }
    public static Serializer PROTOBUF() {
        return PROTOBUF;
    }

    public static Serializer match(int type) {
        switch (type) {
            case 0:
                return JDK;
            case 1:
                return JSON;
            case 2:
                return PROTOBUF;
            default:
                return null;
        }
    }
}
